package com.codingx.validator.controller;

import com.codingx.validator.model.RestResponse;
import com.codingx.validator.model.User;
import org.springframework.http.MediaType;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserRegisterController {

    @PostMapping(value="/register", produces={MediaType.APPLICATION_JSON_VALUE}, consumes={MediaType.APPLICATION_JSON_VALUE})
    public RestResponse<Boolean> register(@RequestBody @Validated User user){
        Assert.notNull(user.getPasswd(),"密码不能为空");
        Assert.hasLength(user.getPasswd(),"密码不能为空字符..请检查");
        return RestResponse.succ(true,"注册成功");
    }

}
